<?php	if(!defined('IN_PHPMYWIND')) exit('Request Error!');
/**
 * 上传附件和上传视频
 * User: Jinqn
 * Date: 14-04-09
 * Time: 上午10:17
 */
//include "Uploader.class.php";
	//引入上传类
require_once(PHPMYWIND_DATA.'/httpfile/upload.class.php');
/* 上传配置 */
$dictor='UE';
if(htmlspecialchars($_GET['action'])=='uploadscrawl')
{
	$dictor='base64';
}
	
/* 生成上传实例对象并完成上传 */
//$up = new Uploader($fieldName, $config, $base64);
$upload_info = UploadFile('upfile', 'true',$dictor);

/**
 * 得到上传文件所对应的各个参数,数组结构
 * array(
 *     "state" => "",          //上传状态，上传成功时必须返回"SUCCESS"
 *     "url" => "",            //返回的地址
 *     "title" => "",          //新文件名
 *     "original" => "",       //原始文件名
 *     "type" => ""            //文件类型
 *     "size" => "",           //文件大小
 * )
 */
/*
	 * 返回上传状态，是数组则表示上传成功
	 * 非数组则是直接返回发生的问题
	 */if(is_array($upload_info)){
			return json_encode($upload_info);
			exit();
		}
				else{
			$str=array(
				"state" => $upload_info,          //上传状态，上传成功时必须返回"SUCCESS"
				 "url" => "/",            //返回的地址
				 "title" => "",          //新文件名
				 "original" => "",    //原始文件名
				 "type" => "",            //文件类型
				 "size" => ""        //文件大小
				);
				return json_encode($str);
			exit();
					}
					

